package com.luli.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 陆离
 * 2025-3-10
 */
@Service
@Slf4j
public class ExcelExportService {
    // 模拟获取复杂的 Map 数据
    public List<Map<String, Object>> getComplexData() {
        List<Map<String, Object>> dataList = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            Map<String, Object> data = new HashMap<>();
            data.put("姓名", "用户" + i);
            data.put("年龄", 20 + i);
            data.put("城市", "城市" + (i % 3));
            dataList.add(data);
        }

        return dataList;
    }

    // 获取表头信息
    public List<List<String>> getHead() {
        List<List<String>> head = new ArrayList<>();
        List<String> head0 = new ArrayList<>();
        head0.add("姓名");
        List<String> head1 = new ArrayList<>();
        head1.add("年龄");
        List<String> head2 = new ArrayList<>();
        head2.add("城市");

        head.add(head0);
        head.add(head1);
        head.add(head2);
        return head;
    }

}
